package com.megvii.koala.data.manager;

import com.megvii.corelib.util.DateTimeUtil;
import com.megvii.koala.data.bean.UserInfoBean;

/**
 * Created by linyue on 15/12/24.
 */
public class UserInfoManager extends KoalaBeanManager<UserInfoBean>
{
    @Override
    protected void update(UserInfoBean bean, boolean sortAndIndex)
    {
        if (bean != null)
        {
            bean.today = DateTimeUtil.toMSTimestamp(bean.today);
            bean.birthday = DateTimeUtil.toMSTimestamp(bean.birthday);
            bean.entry_date = DateTimeUtil.toMSTimestamp(bean.entry_date);
            bean.avatar = makeUrl(bean.avatar);
        }
        super.update(bean, sortAndIndex);
    }

    public UserInfoBean getUserInfo()
    {
        if (this.isEmpty())
        {
            return null;
        }
        else
        {
            return beanList.get(0);
        }
    }
}
